<#assign module="member"/>

<@override name="header">
</@override>
<@override name="body">

<div class="row">
	<div class="col-xs-12">
	    <div class="orders-navt col-xs-9" style="padding-left:0">
	   		<ul class="orders-nav">
	  			<li class="orders-notclick " style="width:90px;"><a class="tab" href="${ctx}/member/list">所有用户</a></li>
		  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/elist">企业信息</a></li>
		  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/gradelist">用户等级</a></li>
		  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/lock">登录记录</a></li>
		  		<@shiro.hasPermission name='blacklist'>
		  			<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/member/blacklist">黑名单</a></li>
		  		</@shiro.hasPermission>
		  		<@shiro.hasPermission name='phonevisit'>
		  			<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/phonevisit/list">回访记录</a></li>
		  		</@shiro.hasPermission>
		  		<@shiro.isMainCompany>
				  <@shiro.hasPermission name='memberapply'>
				  	<#--
				  	<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/memberapply/list">VIP申请</a></li>
				  	-->
				  </@shiro.hasPermission>
			  	</@shiro.isMainCompany>
			  	<@shiro.hasPermission name='receipt'>
			  		<li class="orders-notclick" style="width:90px;"><a class="tab" href="${ctx}/receipt/list">发票申请</a></li>
			   	</@shiro.hasPermission>
			   	<@shiro.hasPermission name='membernotice'>
			   		<li class="orders-click" ><a class="tab" href="${ctx}/membernotice/list">通知</a></li>
			   	</@shiro.hasPermission>
		    </ul>
		</div>
		<div class="col-xs-3">
			<button id="add_button" class="pull-right btn btn-primary" style="display:none;" onclick="window.location='${ctx}/membernotice/add';">&nbsp;发布新通知</button>
  		</div>
	</div>
  	
</div>

<div class="margin-top">
</div>

<div class="tabta-content"> 
	<table class="table table-condensed table-striped">
		<tbody>
			<tr>
				<th style='min-width:500px;'>内容</th>
				<th style='min-width:120px;'>时间</th>
				<th style='min-width:120px;'>操作</th>
			</tr>
			<#if (page.content)?? >
			  	<#list page.content as data>
					<tr class="tr-hui">
						<td>${data.content?if_exists}</td>
						<td>${data.created?string('yyyy/MM/dd HH:mm')}</td>
						<td>
							<@shiro.hasPermission name='membernoticedelete'>
							<a href="javascript:;" data-value="${data.id}" class="btn-link deletethis">删除</a>
							</@shiro.hasPermission>
							<a href="${ctx}/membernotice/edit/${data.id}" class="btn-link">查看</a>
						</td>
					</tr>
				</#list>
			</#if>
		</tbody>
	</table>
	<#if page.totalElements??>
	<ul class="pagination pull-right pagination-sm">
		<li><a>共 ${page.totalElements} 条数据</a></li>
		<@pg.pager items=page.totalElements?number maxPageItems=20 export="currentPageNumber=pageNumber" url="${ctx}/membernotice/list">
			<@pg.index>
				<@pg.first>
					<li><a href="${pageUrl}">&laquo;</a></li>
				</@pg.first>
				<@pg.prev>
					<li><a href="${pageUrl}">&lsaquo;</a></li>
				</@pg.prev>
				<@pg.pages>
					<#if  currentPageNumber == pageNumber >
						<li class="active"><a href="#">${pageNumber}</a></li>
					<#else>
						<li><a href="${pageUrl}">${pageNumber}</a></li>
					</#if>
				</@pg.pages>
				<@pg.next>
					<li><a href="${pageUrl}">&rsaquo;</a></li>
				</@pg.next>
				<@pg.last>
					<li><a href="${pageUrl}">&raquo;</a></li>
				</@pg.last>
			</@pg.index>
		</@pg.pager>
	</ul>
	</#if>
</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	var thisButton;
	function deleteMemberNotice() {
	    $.post('${ctx}/membernotice/delete',{'id':thisButton.attr("data-value")},function(data){
	            if(data.success){
	            	thisButton.parent().parent().remove();
	                $.scojs_message('删除成功', $.scojs_message.TYPE_OK);
	            } else {
	                $.scojs_message(data.message, $.scojs_message.TYPE_ERROR);
	            }
	    },'json');
	}
	$(document).ready(function(){
	    $(".deletethis").click(function(){
	          thisButton = $(this);
	          var confirm = $.scojs_confirm({
	            content: "你真的要删除该通知吗？",
	            action:deleteMemberNotice
	          });
	          confirm.show();
	    });
	    
	    var add_sms=false;
	    var add_app=false;
	    <@shiro.hasPermission name='membersms'>
	    	add_sms=true;
	    </@shiro.hasPermission>
	    <@shiro.hasPermission name='memberappnotice'>
	    	add_app=true;
	    </@shiro.hasPermission>
	    if(add_sms || add_app){
	    	$("#add_button").show();
	    }
	});
</script>
</@override>
<@extends name="../layout.ftl"/>